<?php
namespace App\Http\Controllers\Users;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\User\RegisterService;

class RegisterController extends Controller
{

    /**
     * user register
     */
    public function register(Request $request)
    {
        // 用户基础数据
        $keys = [
            'account',
            'name',
            'area_code',
            'sms_code',
            'invite_code',
            'source',
            'gender',
            'password',
            'interests'
        ];
        // 测试数据
        $keys = array_merge($keys,[
            'lang',
            'birthday',
            'time_period'
        ]);
        // 其他
        $keys = array_merge($keys,['is_login']);
        // 接收数据
        $data = $request->only($keys);
        // 处理数据
        $result = RegisterService::register($data);
        // 返回结果
        return self::response();
    }
}
